<template>
	<view>
		
		<u-tabbar
			:zIndex="9999999"
			:value="current"
			@change="change"
			:fixed="true"
			:placeholder="true"
			activeColor="#0ea26e"
			:safeAreaInsetBottom="false"
		>
			<u-tabbar-item text="首页" icon='home' @click="clickTab(1)" >
				<!-- <image
					class="u-page__item__slot-icon icon"
					slot="active-icon" 
					src="@/static/images/home1.png"
				></image>
				<image
					class="u-page__item__slot-icon icon"
					slot="inactive-icon"
					src="@/static/images/home.png"
				></image> -->
				
			</u-tabbar-item>
			<u-tabbar-item text="设备" icon="tags" @click="clickTab(2)" ></u-tabbar-item>
			<u-tabbar-item text="报警" icon="volume" @click="clickTab(3)" ></u-tabbar-item>
			<u-tabbar-item text="我的" icon="account" @click="clickTab(4)" ></u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		
		props: {
					current: {
						type: Number,
						default: 0,
					}
				},
		data() {
			return {
				name:"tabbar",
				
			}
		},
		methods:{
			change(e){
				let sign = e;
				this.clickTab(sign)
			},
			clickTab(sign){
				let url = ""
				if(sign==1){
					url="/pages/index/index"
				}else if(sign ==2){
					url="/pages/deviceDetail/deviceDetail"
				}else if(sign ==3){
					url="/pages/alarm/alarm"
				}else if(sign ==4){
					url="/pages/user/user"
				}
				uni.navigateTo({
					url: url,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>
<style scoped>
	.icon{width:50rpx;height:50rpx;}
	
</style>

